```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Nginx与Tomcat深度对比 | Web服务器架构分析</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', 'Noto Serif SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        .hero-image {
            background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.3)), url('https://cdn.nlark.com/yuque/0/2024/png/21449790/1721097733183-2c520395-d1d2-40d6-9e00-49c8405b90d1.png');
            background-size: cover;
            background-position: center;
        }
        .drop-cap::first-letter {
            float: left;
            font-size: 4rem;
            line-height: 0.8;
            margin-right: 0.5rem;
            margin-top: 0.3rem;
            font-weight: 700;
            color: #3b82f6;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .fade-in {
            animation: fadeIn 0.5s ease-in;
        }
        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }
        .timeline-item:before {
            content: '';
            position: absolute;
            left: -1.5rem;
            top: 0;
            width: 1rem;
            height: 1rem;
            border-radius: 50%;
            background-color: #3b82f6;
            border: 3px solid white;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero-image min-h-screen flex items-center justify-center text-white">
        <div class="container mx-auto px-6 text-center">
            <h1 class="text-5xl md:text-6xl font-bold mb-6 font-serif">Nginx与Tomcat深度解析</h1>
            <p class="text-xl md:text-2xl mb-8 max-w-3xl mx-auto">揭开高性能Web服务器架构的神秘面纱</p>
            <div class="bg-blue-600 bg-opacity-80 inline-block px-4 py-2 rounded-lg">
                <span class="text-sm tracking-wider">WEB架构核心组件</span>
            </div>
        </div>
    </section>

    <!-- Introduction -->
    <section class="py-16 bg-white">
        <div class="container mx-auto px-6 max-w-5xl">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/2 mb-8 md:mb-0 md:pr-8">
                    <h2 class="text-3xl font-bold mb-6 text-gray-800 font-serif">Web架构中的双雄</h2>
                    <p class="text-gray-700 mb-6 drop-cap">Web架构中非常重要的组件：Nginx和Tomcat。作为一个Java程序员，我们深知在构建高性能、可扩展的Web应用时，选择合适的服务器是至关重要的。而Nginx和Tomcat正是我们在实际项目中经常会用到的两个服务器，它们各自具备独特的优势和功能。</p>
                    
                    <div class="flex space-x-4 mb-6">
                        <div class="bg-blue-50 p-4 rounded-lg flex-1">
                            <i class="fas fa-bolt text-blue-500 text-2xl mb-2"></i>
                            <h3 class="font-bold text-blue-700">Nginx</h3>
                            <p class="text-sm text-gray-600">高性能反向代理与静态资源处理</p>
                        </div>
                        <div class="bg-orange-50 p-4 rounded-lg flex-1">
                            <i class="fas fa-code text-orange-500 text-2xl mb-2"></i>
                            <h3 class="font-bold text-orange-700">Tomcat</h3>
                            <p class="text-sm text-gray-600">强大的Java应用服务器</p>
                        </div>
                    </div>
                </div>
                <div class="md:w-1/2">
                    <div class="bg-gray-100 p-6 rounded-xl shadow-md">
                        <div class="mermaid">
                            graph TD
                                A[客户端请求] --> B[Nginx服务器]
                                B -->|静态资源| C[直接响应]
                                B -->|动态请求| D[Tomcat应用服务器]
                                D --> E[数据库/其他服务]
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Architecture Comparison -->
    <section class="py-16 bg-gray-50">
        <div class="container mx-auto px-6 max-w-5xl">
            <h2 class="text-3xl font-bold mb-12 text-center text-gray-800 font-serif">架构设计对比</h2>
            
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div class="bg-white p-8 rounded-xl shadow-lg card-hover transition-all duration-300">
                    <div class="flex items-center mb-4">
                        <div class="bg-blue-100 p-3 rounded-full mr-4">
                            <i class="fas fa-project-diagram text-blue-500 text-xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">Nginx架构</h3>
                    </div>
                    <div class="pl-16">
                        <p class="text-gray-700 mb-4"><span class="font-bold text-blue-600">事件驱动模型:</span> 采用异步非阻塞I/O，通过高效的多路复用机制处理大量并发连接。</p>
                        <p class="text-gray-700 mb-4"><span class="font-bold text-blue-600">多进程架构:</span> 主进程管理，多个工作进程独立处理请求，提升并发能力和稳定性。</p>
                        <p class="text-gray-700"><span class="font-bold text-blue-600">轻量级模块化:</span> 核心轻量，功能通过模块扩展，易于定制和优化。</p>
                    </div>
                </div>
                
                <div class="bg-white p-8 rounded-xl shadow-lg card-hover transition-all duration-300">
                    <div class="flex items-center mb-4">
                        <div class="bg-orange-100 p-3 rounded-full mr-4">
                            <i class="fas fa-sitemap text-orange-500 text-xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">Tomcat架构</h3>
                    </div>
                    <div class="pl-16">
                        <p class="text-gray-700 mb-4"><span class="font-bold text-orange-600">多线程模型:</span> 每个请求由独立线程处理，适合处理复杂业务逻辑。</p>
                        <p class="text-gray-700 mb-4"><span class="font-bold text-orange-600">Servlet容器:</span> 围绕Servlet规范设计，支持JSP、WebSocket等Java EE技术。</p>
                        <p class="text-gray-700"><span class="font-bold text-orange-600">组件化设计:</span> 通过Catalina、Coyote等组件实现请求处理与连接管理。</p>
                    </div>
                </div>
            </div>
            
            <div class="bg-white p-8 rounded-xl shadow-lg fade-in">
                <h3 class="text-xl font-bold mb-6 text-gray-800 border-b pb-2">架构演化时间线</h3>
                <div class="space-y-8 relative pl-8 timeline-container">
                    <div class="relative timeline-item pl-8">
                        <div class="absolute left-0 top-0 h-full w-0.5 bg-blue-200"></div>
                        <div class="bg-blue-50 p-4 rounded-lg">
                            <p class="text-sm text-blue-500 font-medium">2004年</p>
                            <h4 class="font-bold text-gray-800 mb-2">Nginx首次发布</h4>
                            <p class="text-gray-700">Igor Sysoev开发，专注于解决C10K问题，实现高并发处理</p>
                        </div>
                    </div>
                    <div class="relative timeline-item pl-8">
                        <div class="absolute left-0 top-0 h-full w-0.5 bg-orange-200"></div>
                        <div class="bg-orange-50 p-4 rounded-lg">
                            <p class="text-sm text-orange-500 font-medium">1999年</p>
                            <h4 class="font-bold text-gray-800 mb-2">Tomcat诞生</h4>
                            <p class="text-gray-700">作为Jakarta项目的一部分，实现了Servlet和JSP规范</p>
                        </div>
                    </div>
                    <div class="relative timeline-item pl-8">
                        <div class="absolute left-0 top-0 h-full w-0.5 bg-blue-200"></div>
                        <div class="bg-blue-50 p-4 rounded-lg">
                            <p class="text-sm text-blue-500 font-medium">2011年</p>
                            <h4 class="font-bold text-gray-800 mb-2">Nginx公司成立</h4>
                            <p class="text-gray-700">商业化运作开始，推出Nginx Plus等企业级产品</p>
                        </div>
                    </div>
                    <div class="relative timeline-item pl-8">
                        <div class="absolute left-0 top-0 h-full w-0.5 bg-orange-200"></div>
                        <div class="bg-orange-50 p-4 rounded-lg">
                            <p class="text-sm text-orange-500 font-medium">2005年</p>
                            <h4 class="font-bold text-gray-800 mb-2">Tomcat 5.5发布</h4>
                            <p class="text-gray-700">支持Servlet 2.4和JSP 2.0规范，性能大幅提升</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Core Features -->
    <section class="py-16 bg-white">
        <div class="container mx-auto px-6 max-w-5xl">
            <h2 class="text-3xl font-bold mb-12 text-center text-gray-800 font-serif">核心功能对比</h2>
            
            <div class="grid md:grid-cols-3 gap-6 mb-12">
                <div class="bg-blue-50 p-6 rounded-xl">
                    <div class="text-center mb-4">
                        <i class="fas fa-random text-blue-500 text-3xl"></i>
                    </div>
                    <h3 class="text-xl font-bold text-center mb-3 text-blue-700">反向代理</h3>
                    <p class="text-gray-700 text-sm text-center">Nginx擅长反向代理和负载均衡，支持多种路由策略和健康检查</p>
                </div>
                <div class="bg-purple-50 p-6 rounded-xl">
                    <div class="text-center mb-4">
                        <i class="fas fa-file-code text-purple-500 text-3xl"></i>
                    </div>
                    <h3 class="text-xl font-bold text-center mb-3 text-purple-700">静态资源</h3>
                    <p class="text-gray-700 text-sm text-center">Nginx静态资源处理性能卓越，具备高效缓存和压缩机制</p>
                </div>
                <div class="bg-orange-50 p-6 rounded-xl">
                    <div class="text-center mb-4">
                        <i class="fas fa-cogs text-orange-500 text-3xl"></i>
                    </div>
                    <h3 class="text-xl font-bold text-center mb-3 text-orange-700">动态内容</h3>
                    <p class="text-gray-700 text-sm text-center">Tomcat专注于Servlet/JSP处理，支持复杂业务逻辑和Java EE规范</p>
                </div>
            </div>
            
            <div class="bg-gray-100 p-6 rounded-xl mb-8">
                <div class="mermaid">
                    pie showData
                        title 功能适用场景
                        "反向代理/负载均衡" : 35
                        "静态资源处理" : 25
                        "动态内容处理" : 40
                </div>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8">
                <div>
                    <h3 class="text-xl font-bold mb-4 text-gray-800 flex items-center">
                        <i class="fas fa-shield-alt text-blue-500 mr-2"></i>
                        Nginx安全特性
                    </h3>
                    <ul class="space-y-3">
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span class="flex-1 text-gray-700">SSL/TLS终止与加密传输</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span class="flex-1 text-gray-700">基于IP和速率的访问控制</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span class="flex-1 text-gray-700">WAF集成防御Web攻击</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span class="flex-1 text-gray-700">DDoS防护与流量限制</span>
                        </li>
                    </ul>
                </div>
                
                <div>
                    <h3 class="text-xl font-bold mb-4 text-gray-800 flex items-center">
                        <i class="fas fa-lock text-orange-500 mr-2"></i>
                        Tomcat安全特性
                    </h3>
                    <ul class="space-y-3">
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span class="flex-1 text-gray-700">多种认证机制(BASIC/FORM等)</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span class="flex-1 text-gray-700">基于角色的访问控制</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span class="flex-1 text-gray-700">安全头防护(XSS/点击劫持等)</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span class="flex-1 text-gray-700">定期安全更新与补丁</span>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </section>

    <!-- Performance Comparison -->
    <section class="py-16 bg-gray-50">
        <div class="container mx-auto px-6 max-w-5xl">
            <h2 class="text-3xl font-bold mb-12 text-center text-gray-800 font-serif">性能对比分析</h2>
            
            <div class="bg-white p-8 rounded-xl shadow-lg mb-8">
                <div class="flex flex-col md:flex-row mb-6">
                    <div class="md:w-1/2 mb-6 md:mb-0 md:pr-6">
                        <h3 class="text-xl font-bold mb-4 text-gray-800 border-b pb-2">并发处理能力</h3>
                        <div class="h-64">
                            <div class="mermaid">
                                barChart
                                    title 并发连接数对比(每秒)
                                    x-axis Nginx, Tomcat
                                    y-axis 0, 5000, 10000, 15000, 20000
                                    bar "1000并发" : 18000
                                    bar "1000并发" : 3500
                            </div>
                        </div>
                    </div>
                    <div class="md:w-1/2 md:pl-6">
                        <h3 class="text-xl font-bold mb-4 text-gray-800 border-b pb-2">资源消耗对比</h3>
                        <div class="h-64">
                            <div class="mermaid">
                                barChart
                                    title 资源消耗对比(1000并发)
                                    x-axis CPU使用率, 内存占用
                                    y-axis 0, 20, 40, 60, 80, 100
                                    bar "Nginx" : 25, 300
                                    bar "Tomcat" : 65, 800
                            </div>
                        </div>
                    </div>
                </div>
                
                <div class="grid md:grid-cols-2 gap-6">
                    <div class="bg-blue-50 p-4 rounded-lg">
                        <h4 class="font-bold text-blue-700 mb-2">Nginx优化建议</h4>
                        <ul class="text-sm text-gray-700 space-y-2">
                            <li class="flex items-start">
                                <i class="fas fa-arrow-right text-blue-500 mt-1 mr-2 text-xs"></i>
                                <span>调整worker_processes和worker_connections</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-arrow-right text-blue-500 mt-1 mr-2 text-xs"></i>
                                <span>启用Gzip压缩和静态文件缓存</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-arrow-right text-blue-500 mt-1 mr-2 text-xs"></i>
                                <span>使用epoll/kqueue事件驱动模型</span>
                            </li>
                        </ul>
                    </div>
                    <div class="bg-orange-50 p-4 rounded-lg">
                        <h4 class="font-bold text-orange-700 mb-2">Tomcat优化建议</h4>
                        <ul class="text-sm text-gray-700 space-y-2">
                            <li class="flex items-start">
                                <i class="fas fa-arrow-right text-orange-500 mt-1 mr-2 text-xs"></i>
                                <span>优化线程池(maxThreads, acceptCount等)</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-arrow-right text-orange-500 mt-1 mr-2 text-xs"></i>
                                <span>JVM调优(堆内存,GC策略等)</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-arrow-right text-orange-500 mt-1 mr-2 text-xs"></i>
                                <span>结合Nginx分担静态请求</span>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
            
            <div class="bg-white p-8 rounded-xl shadow-lg">
                <h3 class="text-xl font-bold mb-6 text-gray-800 border-b pb-2">典型部署架构</h3>
                <div class="mermaid">
                    graph LR
                        C[客户端] --> L[负载均衡器]
                        L --> N1[Nginx]
                        L --> N2[Nginx]
                        N1 --> T1[Tomcat集群]
                        N1 --> T2[Tomcat集群]
                        N2 --> T3[Tomcat集群]
                        N2 --> T4[Tomcat集群]
                        T1 --> D[数据库集群]
                        T2 --> D
                        T3 --> D
                        T4 --> D
                </div>
                <div class="mt-6 bg-yellow-50 p-4 rounded-lg">
                    <h4 class="font-bold text-yellow-700 mb-2 flex items-center">
                        <i class="fas fa-lightbulb text-yellow-500 mr-2"></i>
                        架构建议
                    </h4>
                    <p class="text-sm text-gray-700">在实际生产环境中，推荐将Nginx作为前端反向代理和负载均衡器，处理静态资源和请求分发；Tomcat集群作为后端应用服务器，专注于动态内容处理和业务逻辑。这种架构可以充分发挥两者的优势。</p>
                </div>
            </div>
        </div>
    </section>

    <!-- Configuration & Management -->
    <section class="py-16 bg-white">
        <div class="container mx-auto px-6 max-w-5xl">
            <h2 class="text-3xl font-bold mb-12 text-center text-gray-800 font-serif">配置与管理</h2>
            
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div class="bg-white border border-gray-200 rounded-xl overflow-hidden shadow-sm">
                    <div class="bg-blue-600 p-4 text-white">
                        <h3 class="font-bold flex items-center">
                            <i class="fas fa-cog mr-2"></i>
                            Nginx配置示例
                        </h3>
                    </div>
                    <div class="p-6 bg-gray-900 text-gray-300 font-mono text-sm overflow-x-auto">
                        <pre># nginx.conf 示例
worker_processes  4;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       80;
        server_name  localhost;

        location / {
            root   html;
            index  index.html index.htm;
        }

        location /images/ {
            root /data;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}</pre>
                    </div>
                </div>
                
                <div class="bg-white border border-gray-200 rounded-xl overflow-hidden shadow-sm">
                    <div class="bg-orange-600 p-4 text-white">
                        <h3 class="font-bold flex items-center">
                            <i class="fas fa-code mr-2"></i>
                            Tomcat配置示例
                        </h3>
                    </div>
                    <div class="p-6 bg-gray-900 text-gray-300 font-mono text-sm overflow-x-auto">
                        <pre>&lt;!-- server.xml 示例 --&gt;
&lt;Server port="8005" shutdown="SHUTDOWN"&gt;
  &lt;Service name="Catalina"&gt;
    &lt;Connector port="8080" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               redirectPort="8443" /&gt;
    &lt;Engine name="Catalina" defaultHost="localhost"&gt;
      &lt;Host name="localhost" appBase="webapps" 
            unpackWARs="true" autoDeploy="true"&gt;
        &lt;Context path="" docBase="myapp" /&gt;
      &lt;/Host&gt;
    &lt;Engine&gt;
  &lt;Service&gt;
&lt;Server&gt;</pre>
                    </div>
                </div>
            </div>
            
            <div class="grid md:grid-cols-3 gap-6">
                <div class="bg-blue-50 p-6 rounded-lg">
                    <div class="text-blue-500 text-2xl mb-3">
                        <i class="fas fa-sliders-h"></i>
                    </div>
                    <h3 class="font-bold text-gray-800 mb-2">Nginx管理</h3>
                    <p class="text-sm text-gray-700">命令行工具管理，简洁高效。支持热重载配置(nginx -s reload)，第三方工具提供图形界面支持。</p>
                </div>
                <div class="bg-purple-50 p-6 rounded-lg">
                    <div class="text-purple-500 text-2xl mb-3">
                        <i class="fas fa-desktop"></i>
                    </div>
                    <h3 class="font-bold text-gray-800 mb-2">Tomcat管理</h3>
                    <p class="text-sm text-gray-700">内置Web管理界面(Manager App)，支持JMX监控。命令行脚本(startup.sh/shutdown.sh)控制生命周期。</p>
                </div>
                <div class="bg-green-50 p-6 rounded-lg">
                    <div class="text-green-500 text-2xl mb-3">
                        <i class="fas fa-tools"></i>
                    </div>
                    <h3 class="font-bold text-gray-800 mb-2">维护建议</h3>
                    <p class="text-sm text-gray-700">定期检查日志，监控性能指标。保持版本更新，定期安全审计。Nginx配置简洁易维护，Tomcat需更多Java专业知识。</p>
                </div>
            </div>
        </div>
    </section>

    <!-- Use Cases -->
    <section class="py-16 bg-gray-50">
        <div class="container mx-auto px-6 max-w-5xl">
            <h2 class="text-3xl font-bold mb-12 text-center text-gray-800 font-serif">典型使用场景</h2>
            
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div class="bg-white p-8 rounded-xl shadow-lg card-hover transition-all duration-300">
                    <h3 class="text-xl font-bold mb-6 text-gray-800 border-b pb-2 flex items-center">
                        <i class="fas fa-server text-blue-500 mr-3"></i>
                        Nginx适用场景
                    </h3>
                    <ul class="space-y-4">
                        <li class="flex items-start">
                            <div class="bg-blue-100 p-1 rounded-full mr-3 mt-1">
                                <i class="fas fa-check text-blue-500 text-xs"></i>
                            </div>
                            <div>
                                <h4 class="font-bold text-gray-800">高并发静态资源服务</h4>
                                <p class="text-gray-700 text-sm">图片、CSS、JavaScript等静态文件的高效分发</p>
                            </div>
                        </li>
                        <li class="flex items-start">
                            <div class="bg-blue-100 p-1 rounded-full mr-3 mt-1">
                                <i class="fas fa-check text-blue-500 text-xs"></i>
                            </div>
                            <div>
                                <h4 class="font-bold text-gray-800">反向代理与负载均衡</h4>
                                <p class="text-gray-700 text-sm">作为前端代理分发请求到多个后端服务器</p>
                            </div>
                        </li>
                        <li class="flex items-start">
                            <div class="bg-blue-100 p-1 rounded-full mr-3 mt-1">
                                <i class="fas fa-check text-blue-500 text-xs"></i>
                            </div>
                            <div>
                                <h4 class="font-bold text-gray-800">API网关</h4>
                                <p class="text-gray-700 text-sm">微服务架构中的统一入口，实现路由、限流等功能</p>
                            </div>
                        </li>
                        <li class="flex items-start">
                            <div class="bg-blue-100 p-1 rounded-full mr-3 mt-1">
                                <i class="fas fa-check text-blue-500 text-xs"></i>
                            </div>
                            <div>
                                <h4 class="font-bold text-gray-800">Web应用防火墙</h4>
                                <p class="text-gray-700 text-sm">通过模块实现基本的WAF功能，防护常见Web攻击</p>
                            </div>
                        </li>
                    </ul>
                </div>
                
                <div class="bg-white p-8 rounded-xl shadow-lg card-hover transition-all duration-300">
                    <h3 class="text-xl font-bold mb-6 text-gray-800 border-b pb-2 flex items-center">
                        <i class="fas fa-laptop-code text-orange-500 mr-3"></i>
                        Tomcat适用场景
                    </h3>
                    <ul class="space-y-4">
                        <li class="flex items-start">
                            <div class="bg-orange-100 p-1 rounded-full mr-3 mt-1">
                                <i class="fas fa-check text-orange-500 text-xs"></i>
                            </div>
                            <div>
                                <h4 class="font-bold text-gray-800">Java Web应用部署</h4>
                                <p class="text-gray-700 text-sm">传统Servlet/JSP应用的运行环境</p>
                            </div>
                        </li>
                        <li class="flex items-start">
                            <div class="bg-orange-100 p-1 rounded-full mr-3 mt-1">
                                <i class="fas fa-check text-orange-500 text-xs"></i>
                            </div>
                            <div>
                                <h4 class="font-bold text-gray-800">Spring Boot应用</h4>
                                <p class="text-gray-700 text-sm">内嵌Tomcat作为默认Web容器</p>
                            </div>
                        </li>
                        <li class="flex items-start">
                            <div class="bg-orange-100 p-1 rounded-full mr-3 mt-1">
                                <i class="fas fa-check text-orange-500 text-xs"></i>
                            </div>
                            <div>
                                <h4 class="font-bold text-gray-800">企业级应用系统</h4>
                                <p class="text-gray-700 text-sm">ERP、CRM等需要复杂业务逻辑处理的应用</p>
                            </div>
                        </li>
                        <li class="flex items-start">
                            <div class="bg-orange-100 p-1 rounded-full mr-3 mt-1">
                                <i class="fas fa-check text-orange-500 text-xs"></i>
                            </div>
                            <div>
                                <h4 class="font-bold text-gray-800">WebSocket应用</h4>
                                <p class="text-gray-700 text-sm">实时通信、聊天室等需要长连接的应用</p>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
            
            <div class="bg-white p-8 rounded-xl shadow-lg">
                <h3 class="text-xl font-bold mb-6 text-gray-800 border-b pb-2 flex items-center">
                    <i class="fas fa-hands-helping text-purple-500 mr-3"></i>
                    如何选择？
                </h3>
                <div class="mermaid">
                    flowchart TD
                        A[需求分析] --> B{主要处理静态内容?}
                        B -->|是| C[选择Nginx]
                        B -->|否| D{基于Java开发?}
                        D -->|是| E[选择Tomcat]
                        D -->|否| F[考虑其他技术栈]
                        C --> G[高并发场景?]
                        G -->|是| H[Nginx+多Tomcat集群]
                        G -->|否| I[单独使用Nginx或Tomcat]
                </div>
                <div class="mt-6 bg-blue-50 p-4 rounded-lg">
                    <p class="text-sm text-gray-700"><strong>专业建议：</strong> 在实际生产环境中，Nginx和Tomcat通常是互补而非竞争关系。Nginx作为前端处理静态内容和负载均衡，Tomcat作为后端处理Java业务逻辑，这种组合可以充分发挥各自的优势。</p>
                </div>
            </div>
        </div>
    </section>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: { useMaxWidth: true, htmlLabels: true },
            securityLevel: 'loose'
        });
        
        // 简单的滚动动画效果
        document.addEventListener('DOMContentLoaded', function() {
            const fadeElements = document.querySelectorAll('.fade-in');
            
            const observer = new IntersectionObserver((entries) => {
                entries.forEach(entry => {
                    if (entry.isIntersecting) {
                        entry.target.classList.add('opacity-100');
                    }
                });
            }, { threshold: 0.1 });
            
            fadeElements.forEach(el => {
                el.classList.add('opacity-0', 'transition-opacity', 'duration-500');
                observer.observe(el);
            });
            
            // 卡片悬停效果
            const cards = document.querySelectorAll('.card-hover');
            cards.forEach(card => {
                card.addEventListener('mouseenter', () => {
                    card.classList.add('shadow-lg');
                });
                card.addEventListener('mouseleave', () => {
                    card.classList.remove('shadow-lg');
                });
            });
        });
    </script>
</body>
</html>
```